package com.lihuinch.test.dingtalk.eventsubscribe.handler.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.lihuinch.test.dingtalk.eventsubscribe.constant.TestConstants;
import com.lihuinch.test.dingtalk.eventsubscribe.handler.DingTalkEventHandler;
import com.lihuinch.test.dingtalk.eventsubscribe.handler.request.DingTalkUseModifyOrgParam;
import com.lihuinch.test.dingtalk.eventsubscribe.handler.response.DingTalkEventResponse;
import com.lihuinch.test.dingtalk.eventsubscribe.handler.response.DingTalkEventUseModifyOrgResponse;
import com.lihuinch.test.dingtalk.eventsubscribe.handler.response.DingTalkEventVerifyUrlResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * 通讯录用户更改。
 *
 * @author lihu
 * @date 2021-8-27 16:16
 * @since
 */
@Service(DingTalkEventHandler.DING_TALK_EVENT_HANDLER + "_" + TestConstants.DingTalkEvent.Contact.USER_MODIFY_ORG)
public class DingTalkEventUseModifyOrgHandler implements DingTalkEventHandler<DingTalkEventUseModifyOrgResponse> {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public DingTalkEventUseModifyOrgResponse handleEvent(JSONObject param) {

        DingTalkUseModifyOrgParam useModifyOrgParam = JSONObject.toJavaObject(param, DingTalkUseModifyOrgParam.class);

        logger.info("user_modify_org \n{}", JSON.toJSONString(useModifyOrgParam, SerializerFeature.PrettyFormat));


        return new DingTalkEventUseModifyOrgResponse();
    }
}
